import base from './index'

let axios = base.axios
let baseUrl = base.baseUrl

// 获取好友
export const getFriend = params => {
    return axios({
        method: 'post',
        baseURL: `${baseUrl}/friend/friendList`,
        data: params
    }).then(res => res.data)
}

// 获取聊天信息
export const getChatMsg = params => {
    return axios({
        method: 'post',
        baseURL: `${baseUrl}/friend/chatMsg`,
        data: params
    }).then(res => res.data)
}

export const chatgpt = params => {
    return axios({
        method: 'post',
        url: `http://localhost:8888/api/ollama/chat/localKnowledge`,
        data: params,
        responseType: 'stream', // 确保返回的是流式响应
        headers: {
            'Content-Type': 'application/json',
        }
    }).then(response => {
        return response; // 返回整个响应对象
    });
};
